<!--
 * @Author: Lucifer
 * @Date: 2022-03-27 16:32:12
 * @LastEditTime: 2022-03-27 16:45:54
 * @FilePath: \yiyanyun\app\agent\view\edit.html
-->
{include file='public/header'/}

<main class="lyear-layout-content">

    <div class="container-fluid p-t-15">

        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body">

                        <div class="media">
                            <img src="/static/images/users/avatar.jpg" alt="..." class="img-avatar mr-3">
                            <div class="media-body">
                            </div>
                        </div>
                        <hr>
                        <form method="" action="#!" class="site-form">
                            <div class="form-group">
                                <label for="username">用户名</label>
                                <input type="text" class="form-control" name="username" id="username"
                                    value="{$info.user}" disabled="disabled">
                            </div>
                            <div class="form-group">
                                <label for="nickname">昵称</label>
                                <input type="text" class="form-control" name="nick" id="nick"
                                    placeholder="输入您的昵称" value="{$info.nick}">
                            </div>
                            <div class="form-group">
                                <label for="password">密码</label>
                                <input type="text" class="form-control" name="password" id="password"
                                    placeholder="输入您需要更改的密码 无需更改可留空">
                            </div>
                            <button type="button" onclick="save()" class="btn btn-primary">保存</button>
                        </form>

                    </div>
                </div>
            </div>

        </div>

    </div>

</main>

{include file='public/footer'/}

<script>
    function save() {
        nick = $("#nick").val();
        password = $("#password").val();
        $.post("{:url('update')}", { nick: nick, password: password }, function (res) {
            if (res.code == 200) {
                showNotify(res.msg, 'success');
                setTimeout("location.href='/agent/index'", 3000);
            } else {
                showNotify(res.msg, 'danger');
            }
        }, 'json')
    }
</script>